<template>
	<div class="student">
		<h1 ref="title">我是Student组件</h1>
		<button @click="showText">点我提示上方h1标签中的文本</button>
	</div>
</template>

<script>
	export default {
		name:'Student',
		data() {
			return {
				xyz:999
			}
		},
		methods: {
			showText(){
				alert(this.$refs.title.innerText)
			}
		},
	}
</script>

<style scoped>
	.student{
		background-color: pink;
		padding: 10px;
	}
</style>
